
import Vue from 'vue'
import App from './App'
import router from './router'

Vue.config.productionTip = false
import animated from 'animate.css';
import VueCookies from 'vue-cookies'

import md5 from 'js-md5' //引入
Vue.prototype.$md5 = md5; //定义全局变量
import moment from 'moment'
Vue.prototype.$moment = moment //挂载
Vue.use(VueCookies)
Vue.use(animated);

Vue.prototype.$config = _config;

//加载rsa加密包
import {
  JSEncrypt
} from 'jsencrypt'
import puk from '@/js/puk.js'
Vue.prototype.$rsaEncrypt = (val) => {
  let encrypt = new JSEncrypt()
  encrypt.setPublicKey(puk)
  return encrypt.encrypt(val);
}
//加载滚动条
import VueScroller from 'vue-scroller';
Vue.use(VueScroller)
//绑定事件总线
import eventBus from '@/js/eventbus'
//将事件总线挂载到vue对象中
Vue.prototype.$eventBus= eventBus.getInstance();

//挂载用户仓储
import userstore from '@/js/userstore'
Vue.prototype.$user=userstore;
//加载vuex资源
import store from  '@/store/index'

//挂载ajax 帮助类
import ajax from '@/js/ajaxhelper'
Vue.prototype.$ajax=ajax;

//加载 websocket 组件
import VueNativeSock from 'vue-native-websocket'
Vue.use(VueNativeSock, `${_config.wsUrl}`, {
  reconnection: true, // 开启重连
  reconnectionAttempts: 5, // 重试次数
  reconnectionDelay: 3000, //重试的间隔时间
  format: 'json',
  connectManually: true,//开始手动连接
})
//websocket 
import taskSocket from '@/js/taskSocket'
Vue.prototype.$taskSocket=taskSocket

import Chat from 'naruto-vue-beautiful-chat'
Vue.use(Chat);

import client from '@/js/oidc-client.js'
Vue.prototype.$oidcClient=client
new Vue({
  el: '#app',
  router,
  store,
  components: {
    App
  },
  template: '<App/>'
})
